package com.xr.miniprogram.tools;

import com.xr.common.utils.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 数组、字符串转换器
 */
public class StrListTool {
    public static String listToSingle(List<String> strList){
        if (strList!=null && strList.size()>0){
            StringBuilder stringBuffer = new StringBuilder();
            for (String next : strList) {
                stringBuffer.append(next).append(",");
            }
            return stringBuffer.toString();
        }
        return null;
    }
    public static List<String> stringToList(String str){
        if(StringUtils.isNotNull(str)){
            return new ArrayList<>(Arrays.asList(str.split(",")));
        }
        return new ArrayList<>();
    }
}
